import request from '@/utils/request'

function treeData () {
  return request({
    url: '/dept/tree',
    method: 'get'
  });
}

function addDept (data) {
  return request({
    url: '/dept/add',
    method: 'post',
    data
  });
}

function editDept (data) {
  return request({
    url: '/dept/update',
    method: 'post',
    data
  });
}

function delDept (id) {
  return request({
    url: '/dept/delete',
    method: 'get',
    params: {
      id: id
    }
  })
}

function getById (id) {
  return request({
    url: '/dept/info',
    method: 'get',
    params: {
      id: id
    }
  });
}

export {
  treeData,
  addDept,
  editDept,
  delDept,
  getById
}
